package com.todo.auth.common.enums;

import java.util.concurrent.TimeUnit;

/**
 * @author azhebuxing
 */
public enum AuthCacheKeyEnum {

    /**
     * Redis各类缓存集合
     */
    CAPTCHAT("captcha_codes:", 2, TimeUnit.MINUTES),
    LOGIN_USER_KEY("login_tokens:", 60*60*24*7, TimeUnit.MINUTES),
    RATE_LIMIT_KEY("rate_limit:", 1, TimeUnit.MINUTES),

    ;


    AuthCacheKeyEnum(String key, int expiration, TimeUnit timeUnit) {
        this.key = key;
        this.expiration = expiration;
        this.timeUnit = timeUnit;
    }

    private final String key;
    private final int expiration;
    private final TimeUnit timeUnit;

    public String key() {
        return key;
    }

    public int expiration() {
        return expiration;
    }

    public TimeUnit timeUnit() {
        return timeUnit;
    }

}
